<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2019/6/5
  Time: 10:29
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Traveler Blog-->个人中心</title>
    <link rel="stylesheet" type="text/css" href="/client/css/common.css"/>
    <link rel="stylesheet" type="text/css" href="/client/css/main.css"/>
    <link rel="shortcut icon" href="/client/images/tou.ico">
    <link href="/client/css/bootstrap.min.css" type="text/css" rel="stylesheet">
    <link href="/client/css/style.css" type="text/css" rel="stylesheet">
    <link type="text/css" href="/client/css/nprogress.css" rel="stylesheet">
    <script type="application/javascript">
        function passwordCheck() {
            var password = $("#pass-password").val();
            var new_password = $("#new-password").val();
            if (password == null || password == "") {
               alert("密码不能为空");
                return;
            }
            if (new_password == null || new_password == "") {
                alert("要修改的密码不能为空");
                return;
            }
            if (password == new_password){
                alert("要修改的密码和原密码要不一样");
                return;
            }
            $("#myform").submit();
        }

    </script>
</head>
<body>
<section class="container user-select">
    <jsp:include page="head.jsp"/>
    <!--/超小屏幕可见-->
    <div class="content-wrap"><!--内容-->
        <div class="content">
            <div class="container">
                <div class="col-md-6 column" style="margin-top: 15%">
                    <form action="/user/updatePassword.do" method="post" name="myform" id="myform">
                        <input type="hidden" name="uid" value="${userAll.uid}">
                        <table class="insert-tab" width="100%">
                            <tbody>
                            <tr>
                                <th width="20%">用户名：</th>
                                <td width="80%">
                                    <p name="username" type="text"style="width: 100%">${userAll.username}</p>
                                </td>
                            </tr>
                            <tr>
                                <th>原密码:</th>
                                <td>
                                    <input name="password" id="pass-password" type="password" placeholder="如不需要更改密码,请不要输入" style="width: 100%">
                                </td>
                            </tr>
                            <tr>
                                <th>新密码:</th>
                                <td>
                                    <input name="newpassword" id="new-password" type="password" placeholder="如不需要更改密码,请不要输入" style="width: 100%">
                                </td>
                            </tr>
                            <tr>
                                <th></th>
                                <td>
                                    <button class="btn btn-primary btn6 mr10" type="button" onclick="passwordCheck()">修改</button>
                                    <input class="btn btn6" onClick="history.go(-1)" value="返回" type="button">
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </form>
                </div>
            </div>
        </div>
            <!--/banner-->

        </div>
    </div>
    <!--/内容-->
    <aside class="sidebar visible-lg"><!--右侧>992px显示-->
        <div class="sentence"> <strong>用户登录</strong>
            <div style="text-align: center;margin-top: 3px">
                <c:choose>
                    <c:when test="${empty user}">
                        <a target="_self" href="/client/login.jsp"> Hi,请登录</a> | <a target="_self" href="/client/regist.jsp">注册</a> | <a>找回密码</a>
                    </c:when>
                    <c:otherwise>
                        <a style="color: #337ab7">Hi,${user.username}</a> |  <a href="/user/exit.do">退出登录</a>
                    </c:otherwise>
                </c:choose>
            </div>
        </div>
        <div class="sentence"> <strong>每日一句</strong>
            <h2 id="time"></h2>
            <p>你是我人生中唯一的主角，我却只能是你故事中的一晃而过得路人甲。</p>
        </div>
        <div class="sentence"> <strong>每日天气</strong>
            <iframe name="weather_inc" src="http://i.tianqi.com/index.php?c=code&id=2&num=1" width="220" height="70" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>
        </div>
        <jsp:include page="/client/menu_search.jsp"/>
    </aside>
    <!--/右侧>992px显示-->
    <footer class="footer">POWERED BY &copy;<a href="#">个人技术博客 XXXXX.COM</a> ALL RIGHTS RESERVED &nbsp;&nbsp;&nbsp;<span>
        <a href="http://www.mycodes.net/" target="_blank">源码之家</a></span>
        <span style="display:none"><a href="">网站统计</a></span> </footer>
</section>
<div><a href="javascript:;" class="gotop" style="display:none;"></a></div>
<!--/返回顶部-->
<script src="/client/js/jquery-2.1.4.min.js" type="text/javascript"></script>
<script src="/client/js/nprogress.js" type="text/javascript" ></script>
<script src="/client/js/bootstrap.min.js" type="text/javascript"></script>
<script type="application/javascript">
    $(function() {
        var myDate = new Date;
        var year = myDate.getFullYear(); //获取当前年
        var mon = myDate.getMonth() + 1; //获取当前月
        var date = myDate.getDate(); //获取当前日
        // var h = myDate.getHours();//获取当前小时数(0-23)
        // var m = myDate.getMinutes();//获取当前分钟数(0-59)
        // var s = myDate.getSeconds();//获取当前秒
        var week = myDate.getDay();
        var weeks = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
        console.log(year, mon, date, weeks[week])
        $("#time").html(year + "年" + mon + "月" + date + "日" + weeks[week]);
    })
</script>
<script type="text/javascript">
    //页面加载
    $('body').show();
    $('.version').text(NProgress.version);
    NProgress.start();
    setTimeout(function() { NProgress.done(); $('.fade').removeClass('out'); }, 1000);
    //返回顶部按钮
    $(function(){
        $(window).scroll(function(){
            if($(window).scrollTop()>100){
                $(".gotop").fadeIn();
            }
            else{
                $(".gotop").hide();
            }
        });
        $(".gotop").click(function(){
            $('html,body').animate({'scrollTop':0},500);
        });
    });
    //提示插件启用
    $(function () {
        $('[data-toggle="popover"]').popover();
    });
    $(function () {
        $('[data-toggle="tooltip"]').tooltip();
    });
    //鼠标滑过显示 滑离隐藏
    $(function(){
        $(".carousel").hover(function(){
            $(this).find(".carousel-control").show();
        },function(){
            $(this).find(".carousel-control").hide();
        });
    });
    $(function(){
        $(".hot-content ul li").hover(function(){
            $(this).find("h3").show();
        },function(){
            $(this).find("h3").hide();
        });
    });
    //页面元素智能定位
    $.fn.smartFloat = function() {
        var position = function(element) {
            var top = element.position().top; //当前元素对象element距离浏览器上边缘的距离
            var pos = element.css("position"); //当前元素距离页面document顶部的距离
            $(window).scroll(function() { //侦听滚动时
                var scrolls = $(this).scrollTop();
                if (scrolls > top) { //如果滚动到页面超出了当前元素element的相对页面顶部的高度
                    if (window.XMLHttpRequest) { //如果不是ie6
                        element.css({ //设置css
                            position: "fixed", //固定定位,即不再跟随滚动
                            top: 0 //距离页面顶部为0
                        }).addClass("shadow"); //加上阴影样式.shadow
                    } else { //如果是ie6
                        element.css({
                            top: scrolls  //与页面顶部距离
                        });
                    }
                }else {
                    element.css({ //如果当前元素element未滚动到浏览器上边缘，则使用默认样式
                        position: pos,
                        top: top
                    }).removeClass("shadow");//移除阴影样式.shadow
                }
            });
        };
        return $(this).each(function() {
            position($(this));
        });
    };
    //启用页面元素智能定位
    $(function(){
        $("#search").smartFloat();
    });
    //异步加载更多内容
    jQuery("#pagination a").on("click", function ()
    {
        var _url = jQuery(this).attr("href");
        var _text = jQuery(this).text();
        jQuery(this).attr("href", "javascript:void(0);");
        jQuery.ajax(
            {
                type : "POST",
                url : _url,
                success : function (data)
                {
                    //将返回的数据进行处理，挑选出class是news-list的内容块
                    result = jQuery(data).find(".row .news-list");
                    //newHref获取返回的内容中的下一页的链接地址
                    nextHref = jQuery(data).find("#pagination a").attr("href");
                    jQuery(this).attr("href", _url);
                    if (nextHref != undefined)
                    {
                        jQuery("#pagination a").attr("href", nextHref);
                    }
                    else
                    {
                        jQuery("#pagination a").html("下一页没有了").removeAttr("href")
                    }
                    // 渐显新内容
                    jQuery(function ()
                    {
                        jQuery(".row").append(result.fadeIn(300));
                        jQuery("img").lazyload(
                            {
                                effect : "fadeIn"
                            });
                    });
                }
            });
        return false;
    });
</script>
</body>
</html>
